wayland: avoid returning NULL when getting a cursor
authorThomas Wood <thomas.wood@intel.com>
Tue, 5 Feb 2013 19:11:02 +0000 (19:11 +0000)
committerThomas Wood <thomas.wood@intel.com>
Wed, 6 Feb 2013 16:56:44 +0000 (16:56 +0000)
https://bugzilla.gnome.org/show_bug.cgi?id=693257

gdk/wayland/gdkcursor-wayland.c

index 4f87164c328fd3b6a7004e73403fc146572c1d5a..ce6456515cbd0a7c0a7ea25b82facb5f3f478367 100644 (file)
@@ -298,8 +298,14 @@ _gdk_wayland_display_get_cursor_for_name (GdkDisplay  *display,
   if (!cursor)
     {
       g_warning (G_STRLOC ": Unable to load %s from the cursor theme", name);
-      g_object_unref (private);
-      return NULL;
+
+      /* return the left_ptr cursor as a fallback */
+      cursor = wl_cursor_theme_get_cursor (wayland_display->cursor_theme,
+                                           "left_ptr");
+
+      /* if the fallback failed to load, return a blank pointer */
+      if (!cursor)
+        return GDK_CURSOR (private);
     }
 
   /* TODO: Do something clever so we can do animated cursors - move the